/**
 * Date: 2004-4-4
 * Time: 23:07:28
 */

package org.cnmarc4j;

import org.cnmarc4j.cnmarc.Leader;

/**
 * Defines Java callbacks to handle a collection of MARC records.
 * A record collection include "Leader", "Directory" and "Variable Fields".
 */
public interface MarcHandler {

    /**
     * Receives notification at the start of the collection.
     */
    public abstract void startCollection();

    /**
     * Receives notification at the end of the collection.
     */
    public abstract void endCollection();

    /**
     * Receives notification at the start of each record.
     * After the "Leader", the record starts.
     *
     * @param leader the {@link org.cnmarc4j.cnmarc.Leader} object
     * containing the record label
     */
    public abstract void startRecord(Leader leader);

    /**
     * Receives notification at the end of each record.
     */
    public abstract void endRecord();

    /**
     * Receives notification of a control field.
     *
     * @param tag the tag name
     * @param data the control field data
     */
    public abstract void controlField(String tag, char[] data);

    /**
     * Receives notification at the start of each data field.
     *
     * @param tag the tag name
     * @param ind1 the first indicator value
     * @param ind2 the second indicator value
     */
    public abstract void startDataField(String tag, char ind1, char ind2);

    /**
     * Receives notification at the end of each data field
     *
     * @param tag the tag name
     */
    public abstract void endDataField(String tag);

    /**
     * Receives notification of a data element (subfield).
     *
     * @param code the data element identifier
     * @param data the data element
     */
    public abstract void subfield(char code, char[] data);

}